import React from "react"
export default  class Todo extends  React.PureComponent{
    constructor(props){
        super(props)
        this.state = {
            items:[1,2,3,4]
        }
    }
    handleClick=()=>{
        const {items} = this.state
        items.pop()
        this.setState({
            items
        })
    }
    shouldComponentUpdate(){
        return true
    }
    render(){
        return (
            <div>
                <ul>
                    {this.state.items.map((item,index)=>(
                        <li key={index}>{item}</li>
                    ))}
                </ul>
                <button onClick={this.handleClick}>delete</button>
            </div>
        )
    }
}